<template>
    <view>
        <view class="cu-modal bottom-modal" :class="modalNameDetail=='bottomModal'?'show':''" @tap="hideModal">
            <view class="cu-dialog" @tap.stop="">
                <view class="cu-bar bg-white">
                    <view class="action text-green" @tap="confirm">确定</view>
                    <view class="action text-blue" @tap="hideModal">取消</view>
                </view>
                <view class="">
                    <form>
                        <view class="cu-form-group">
                            <view class="title">整改项</view>
                            <view>现场整改</view>
                        </view>
                        <view class="cu-form-group" style="min-height: 0;"></view>
                        <view class="cu-bar bg-white">
                            <view class="action text-black">文件上传</view>
                        </view>
                        <view class="cu-form-group">
                            <js-uploadfile  v-model="dInfoItem.dataMap"  :biz-key="dInfoItem.id" biz-type="rectList_file" uploadType="all" uploadText="请上传文件" style="width: 100%"></js-uploadfile>
                        </view>
                        
                        <view class="cu-form-group">
                            <view class="title">整改期限</view>
                            <picker mode="date" :value="dInfoItem.endtime ? dInfoItem.endtime : date" start="2015-09-01" @change="DateChange">
                                <view class="picker">
                                    {{dInfoItem.endtime ? dInfoItem.endtime : date}}
                                </view>
                            </picker>
                        </view>
                        <view class="cu-form-group" style="min-height: 0;"></view>
                        <view class="cu-bar bg-white">
                            <view class="action text-black">整改措施</view>
                        </view>
                        <view class="cu-form-group">
                            <textarea maxlength="-1" :disabled="modalName!=null" @input="textareaAInput" placeholder="整改措施" v-model="dInfoItem.rectificationmeasures"></textarea>
                        </view>
                        <!-- <view class="cu-form-group align-start">
                            <view class="title">文本框</view>
                            <textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" placeholder="多行文本输入框"></textarea>
                        </view> -->

                    </form>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
    export default {
		props: {
			modalNameDetail:{
				type: String,
				default: 'bottomModal'
			},
            dInfoItem:{
                type: Object,
                default:()=>{
                    return {}
                }
            }
        },
        data() {
            return {
                // modalName:'bottomModal',
				imgList:[],
                // date: '2024-03-12',
                // date 取当前时间
                date: new Date().toISOString().substring(0, 10),
                modalName:null,
            }
        },
        onLoad(e){
            console.log(e,'e===')
        },
        created() {
            console.log(this.modalNameDetail,'modalNameDetail',this.dInfoItem,'dInfoItem')
        },
        methods: {
            showModal() {
                // this.modalName = 'bottomModal'
				this.$emit('modalNameDetailEmit', 'bottomModal')
            },
            hideModal() {
                // this.modalName = null
				this.$emit('modalNameDetailEmit', null)
            },
			ChooseImage() {
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ["original", "compressed"], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ["album"], //从相册选择
					success: (res) => {
						if (this.dInfoItem.zhengGaiFileUrl.length != 0) {
							this.dInfoItem.zhengGaiFileUrl = this.dInfoItem.zhengGaiFileUrl.concat(res.tempFilePaths);
							this.$u.toast("上传成功");
						} else {
							this.dInfoItem.zhengGaiFileUrl = res.tempFilePaths;
						}
					}
				});

			},
			DateChange(e) {
				this.dInfoItem.endtime = e.detail.value
			},
			confirm(){
				this.$u.toast("确认成功");	
                console.log(this.dInfoItem);	
                this.dInfoItem.endtime = this.dInfoItem.endtime ? this.dInfoItem.endtime : new Date().toISOString().substring(0, 10);	
                console.log(this.dInfoItem);	
                this.$emit("dInfoItemEmit",this.dInfoItem);
				this.$emit("modalNameDetailEmit",null);
			},
            textareaAInput(e){
                this.dInfoItem.rectificationmeasures = e.detail.value
            }
		}
    }

</script>
<style scoped lang="scss">
.cu-modal{
	z-index: 998;
    text-align: left;
}
</style>
